<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/jstl/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/jstl/fn.tld" prefix="fn" %>
<%@ taglib uri="/WEB-INF/jstl/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/jstl/spring-form.tld" prefix="form" %> 
<%@ taglib uri="/WEB-INF/jstl/spring.tld" prefix="spring"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <base href="<%=basePath%>">
    
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
   
    <title>购物车信息页面</title>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>assets/bootstrap/css/resetPro.css">
	<link href="<%=basePath%>assets/bootstrap/css/bootstrap-combined.min.css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>assets/bootstrap/js/jquery-2.0.0.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>assets/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>assets/bootstrap/js/jquery-ui.js"></script>
	<script type="text/javascript" src="<%=basePath%>assets/bootstrap/js/jquery.ui.touch-punch.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>assets/bootstrap/js/jquery.htmlClean.js"></script>
	<script type="text/javascript" src="<%=basePath%>assets/bootstrap/ckeditor/ckeditor.js"></script>
	<script type="text/javascript" src="<%=basePath%>assets/bootstrap/ckeditor/config.js"></script>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>assets/bootstrap/Font-Awesome-3.2.1/css/font-awesome.min.css">
	<!--这个js有时候会冲突-->
	<!--<script type="text/javascript" src="<%=basePath%>bootstrap/js/scripts.js"></script>-->
	<link rel="stylesheet" href="<%=basePath%>assets/onedate/css/BeatPicker.min.css"/>
    <script src="<%=basePath%>assets/onedate/js/BeatPicker.min.js"></script>
    <script src="<%=basePath%>assets/onedate/documents/js/prism.js"></script>
	
	<style type="text/css">
		a:hover{
			text-decoration: none!important;
		}
		.zerodiv{
			margin-top: 25px;
		}
		.cheSpan{
				font-size:24px !important;
				line-height:30px;
				display: inline-block!important;
				min-width: 25px;
		}
		.xSpan{
				font-size:18px !important;
				line-height:35px;
			}
		.z5{
			margin: 0 10px;
		}
		.datatable th, .datatable td{
		text-align:center!important;
		vertical-align:middle!important;
		}
		.cartgoodsdiv{
			width: 90%;
			margin: 0px auto;
			margin-top:22px;
		}
		.spandiv{
			width: auto!important;
			margin: 0 10px;
		}		
		</style>
</head>
 <body style="min-height: 660px; cursor: auto;" class="edit">
   <div class="container-fluid">
   <div class="row-fluid">
		<div class="span12">
			<!--引入Top导航-->
			<%@include file="member/shared/pageTop.jsp"%>
		</div>
	</div>
	<div class="row-fluid zerodiv">
		<div class="span12">
			<div class="row-fluid">
				<div class="span12">
						<!-- 显示提示信息 -->
						<%@include file="admin/shared/info.jsp"%>
					<div class="row-fluid cartgoodsdiv" >
					<c:choose>
		  				<c:when test="${empty cartInfo}">
							<h4 class="text-center text-error">
									[${empty member?'未登录':member.name}]尚未添加商品到购物车
							</h4>
						</c:when>
						<c:otherwise>
						<!-- 购物车信息，操作-->
						  <table class="table foottable" >
							<tbody>
								<tr >
								<td >
								<div class="uldiv pagination pagination-left ">
									<span class="label badge-success xSpan">总数:</span>
									<span class="label badge-info xSpan">${cartInfo.numSum}</span>
									<span class="label badge-info xSpan">(件)</span>
									<span class="label badge-success xSpan">项数:</span>
									<span  class="label badge-info xSpan">${cartInfo.goodsItemSum}</span>
									<span  class="label badge-info xSpan">(项)</span>
									<span class="label badge-success xSpan">总计:</span>
									<span class="label badge-info xSpan">${cartInfo.priceSum}</span>
									<span class="label badge-info xSpan">(￥)</span>
								 </div>
								</td>
								<td >
									<div class="pagination pagination-right">
										<ul class="oneul">
											<li>
											    <div class="spandiv">
											    <span class="label  btn-info xSpan">
											    <span class="icon-shopping-cart  z5"></span>购物车管理>>>&nbsp;&nbsp;</span>
											    </div>
											</li>
											<li>
											  <div class="spandiv">
											    <button type="button"  class="btn  btn-success " 
												onclick="javascript:window.location.href='<%=basePath%>order/build?oper=checkoutCart';">
												<span class="icon-check-sign cheSpan"></span>结账</button>
											</div>
											</li>
											<li>
											 <div class="spandiv">
											    <button type="button"  class="btn  btn-danger " 
												onclick="javascript:window.location.href='<%=basePath%>cart/clear';">
												<span class="icon-warning-sign cheSpan"></span>清空购物车</button>
											 </div>
											</li>
										</ul>
									</div>
								</td>
								</tr>
							</tbody>
				 	</table>
							
						<!-- 循环商品无分页 -->
						<div class="">
							<table class="table table-bordered datatable">
								<thead style="background:#F5F5F5" >
									<tr>
										
										<th>
											图片
										</th>
										<th>
											商品名
										</th>
										<th>
											 单价(￥)
										</th>
										<th>
											数量(件)
										</th>
										<th>
											小计(￥)
										</th>
										<th>
											操作
										</th>
									</tr>
								</thead>
							<c:choose>
					  		<c:when test="${(empty cartInfo.goodsItemList) or (fn:length(cartInfo.goodsItemList)<1)}">
						  		<h4 class="text-center text-error">
									[${empty member?'未登录':member.name}]购物车商品信息为空
								</h4>
							</c:when>
							<c:otherwise>
		 					
								<tbody>
								<% 
								int i=0; 
								%>
								<c:forEach items="${cartInfo.goodsItemList}" var="goods">
								
								<% i++;%>
									<tr class="<% if(i%2!=0){%>warning<%}else{%>info<%}%>">
										
										<td>
											<div class="width130">
												<c:choose>
										  		<c:when test="${empty goods.img}">
										  			<img src="<%=basePath%>assets/goodsimg/404.ico"  alt="${goods.img}" width="50px" alt="封面不存在"/>
												</c:when>
												<c:otherwise>
													<img src="<%=basePath%>assets/goodsimg/${goods.img}"  alt="${goods.img}" width="120px"/>
												</c:otherwise>
												</c:choose>
											</div>
										</td>
										<td>
											${goods.name}
										</td>
										<td>
											${goods.price}
										</td>
										<td>
											${goods.num}
										</td>
										<td>
											${goods.num*goods.price}
										</td>
										<td>
											<button type="button"  class="btn " 
												onclick="javascript:window.location.href='<%=basePath%>cart/remove?id=${goods.id}';">
											<span class="icon-remove cheSpan"></span>移除</button>
										</td>
									</tr>
								</c:forEach>	
								</tbody>
								</c:otherwise>
								</c:choose>
							</table>
						</div>
					</c:otherwise>
					</c:choose>
					<!-- 商品信息显示结束 -->	
					</div>
			</div>
		</div>
	</div>
</div>
  </body>
</html>
